<?php

	// TITLE: Account_recovery_status AUTO MODEL
	// FILE: scaffolding/model/account_recovery_status.php
	// AUTHOR: AUTOGEN
	// CREATED: 2015/04/20 07:49:57
	// DESCRIPTION: 
	// REQUIREMENTS: 

	$createAccountRecoveryStatus = function($con, $accountRecoveryStatus) {
		$sql = 'INSERT INTO account_recovery_status (id, title, description) VALUES (';
		$sql .= $account_recovery_status->getId() . ', ';
		$sql .= $account_recovery_status->getTitle() . ', ';
		$sql .= $account_recovery_status->getDescription() . ')';
		$sql .= ')';
		$result = mysqli_query($con, $sql);
		$id = ($result) ? mysqli_insert_id($con) : $result;
		mysqli_close($con);
		return $id;
	};

	$readAccountRecoveryStatus = function($con, $id) {
		$sql = 'SELECT * FROM account_recovery_status WHERE id = ' . $id;
		$results = mysqli_query($con, $sql);
		mysqli_close($con);
		if ($results) {
			$result = mysqli_fetch_array($results);
			$accountRecoveryStatus = new AccountRecoveryStatus();
			$accountRecoveryStatus->setId(result[0]);
			$accountRecoveryStatus->setTitle(result[1]);
			$accountRecoveryStatus->setDescription(result[2]);
		} else {
			$accountRecoveryStatus = false;
		}
		return $accountRecoveryStatus;
	};

	$updateAccountRecoveryStatus = function($con, $accountRecoveryStatus) {
		$sql = 'UPDATE account_recovery_status SET ';
		$sql .= 'id = ' . $account_recovery_status->getId() . ', ';
		$sql .= 'title = ' . $account_recovery_status->getTitle() . ', ';
		$sql .= 'description = ' . $account_recovery_status->getDescription() ;
		$sql .= 'WHERE id = ' . id;
		$result = mysqli_query($con, $sql);
		mysqli_close($con);
		return $result;
	};

	$deleteAccountRecoveryStatus = function($con, $id) {
		$sql = 'DELETE FROM account_recovery_status WHERE id = ' . $id;
		$result = mysqli_query($con, $sql);
		mysqli_close($con);
		return $result;
	};

	$listAccountRecoveryStatus = function($con) {
		$sql = 'SELECT * FROM account_recovery_status';
		$results = mysqli_query($con, $sql);
		mysqli_close($con);
		if ($results) {
			$accountRecoveryStatuss = array();
			while ($result = mysqli_fetch_array($results)) {
				$accountRecoveryStatus = new AccountRecoveryStatus();
				$accountRecoveryStatus->setId(result[0]);
				$accountRecoveryStatus->setTitle(result[1]);
				$accountRecoveryStatus->setDescription(result[2]);
				$accountRecoveryStatuss[] = accountRecoveryStatus;
			}// end while
		} else {
			$accountRecoveryStatuss = false;
		}
		return $accountRecoveryStatuss;
	};

